# -*- coding: utf-8 -*-
# @Time : 2021/2/2 9:31
# @Author : geyue
# @Site : 
# @File : adminx.py.py
# @Software: PyCharm

# from notifications.admin import NotificationAdmin
from my_notifications.models import MyNotification
import xadmin


class MyNotificationAdmin(object):
    raw_id_fields = ('recipient',)
    list_display = ('recipient', 'actor', 'verb', 'description',
                    'level', 'unread')
    list_filter = ('level', 'unread', 'public', 'timestamp',)

    def get_queryset(self, request):
        qs = super(MyNotificationAdmin, self).get_queryset(request)
        return qs.prefetch_related('actor')


xadmin.site.register(MyNotification, MyNotificationAdmin)
# class MyNotificationAdmin(object):
#     list_display = []
#     list_filter = ('level', 'unread', 'public', 'timestamp',)
#
#
# xadmin.site.register(MyNotification, MyNotificationAdmin)